package cn.zjj;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker//开启熔断
public class OrderApp {

    public static void main(String[] args) {
        SpringApplication.run(OrderApp.class,args);
    }
    @Bean//返回springboot中http连接的对象,相当于交给容器管理了
    @LoadBalanced//负载均衡 如果启动两个相同应用,不同端口,不开启负载均衡会500报错
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }



}
